/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.uoc.tdp.client.informes;

import edu.uoc.tdp.beans.informes.Universitat;
import edu.uoc.tdp.beans.proves.Prova;
import edu.uoc.tdp.common.EOlympicsException;
import edu.uoc.tdp.common.EOlympicsUtils;
import edu.uoc.tdp.common.RemotInformesInterface;
import edu.uoc.tdp.common.TDSLanguageUtils;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Buixa
 */
public class PantallaProvesFinalitzades extends javax.swing.JFrame {
    
    private RemotInformesInterface remot;
    private DefaultTableModel dtm;
    private javax.swing.JTable jTable1;
    private javax.swing.JScrollPane jScrollPane2;
    /**
     * Creates new form PantallaProvesFinalitzades
     */
    public PantallaProvesFinalitzades() {
        try {
            initComponents();
            inicialitzarComponets();
        } catch (MalformedURLException e) {
            JOptionPane.showMessageDialog(null, TDSLanguageUtils.getMessage("informes.ERR_RMI_URL"), "Error", JOptionPane.ERROR_MESSAGE);
        } catch (NotBoundException e) {
            JOptionPane.showMessageDialog(null, TDSLanguageUtils.getMessage("informes.ERR_RMI_INIT"), "Error", JOptionPane.ERROR_MESSAGE);
        } catch (RemoteException e) {
            JOptionPane.showMessageDialog(null, TDSLanguageUtils.getMessage("informes.ERR_REMOT"), "Error", JOptionPane.ERROR_MESSAGE);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
    
    
    private void inicialitzarComponets() throws IOException, NotBoundException, RemoteException, EOlympicsException{
        //Literals
        TDSLanguageUtils.setDefaultLanguage("edu/uoc/tdp/i18n/messages");
        setTitle(TDSLanguageUtils.getMessage("informes.titol"));
        
        ArrayList<Universitat> universitats = new ArrayList<Universitat>();
        universitats.add(null);
        for (Universitat u : Universitat.values()){
            universitats.add(u);
        }
        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(universitats.toArray()));
        
        jLabel1.setText(TDSLanguageUtils.getMessage("informes.subtitol"));
        jLabel2.setText(TDSLanguageUtils.getMessage("informes.universitat"));
        jLabel3.setText(TDSLanguageUtils.getMessage("informes.prova"));
        jLabel4.setText(TDSLanguageUtils.getMessage("informes.dinscripciofins"));
        jLabel5.setText(TDSLanguageUtils.getMessage("informes.drealitzaciofins"));
        jLabel6.setText(TDSLanguageUtils.getMessage("informes.fins"));
        jLabel7.setText(TDSLanguageUtils.getMessage("informes.fins"));
        jTextField1.setText(TDSLanguageUtils.getMessage("informes.formatdata"));   
        jTextField2.setText(TDSLanguageUtils.getMessage("informes.formatdata"));   
        jTextField3.setText(TDSLanguageUtils.getMessage("informes.formatdata"));   
        jTextField4.setText(TDSLanguageUtils.getMessage("informes.formatdata"));   
        jButton1.setText(TDSLanguageUtils.getMessage("informes.filtrar"));   
        
        Properties prop = new Properties();
        URL url = ClassLoader.getSystemResource("edu/uoc/tdp/properties/configuration.properties");
        prop.load(url.openStream());
        remot=(RemotInformesInterface)Naming.lookup(prop.getProperty("pathrmi_informes"));
                //alumne = remoto.getAlumne(login);
        List<Prova> proves = remot.getProvesTancades();
        proves.add(0,new Prova(null, ""));
        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(proves.toArray()));
        jScrollPane2 = new javax.swing.JScrollPane();
        String [] columnes = new String [] {
                TDSLanguageUtils.getMessage("informes.prova"),
                TDSLanguageUtils.getMessage("informes.tipus"),
                TDSLanguageUtils.getMessage("informes.preguntes"),
                TDSLanguageUtils.getMessage("informes.dinscripcio"),
                TDSLanguageUtils.getMessage("informes.dinscripcio_fi"),
                TDSLanguageUtils.getMessage("informes.drealitzacio"),
                TDSLanguageUtils.getMessage("informes.drealitzacio_fi"),
                TDSLanguageUtils.getMessage("informes.places"),
            };
        
        dtm= new DefaultTableModel(null, columnes);
        jTable1 = new JTable(dtm);
        jTable1.setAutoCreateRowSorter(true);
        jScrollPane2.setViewportView(jTable1);
        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 666, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE)
                .addContainerGap())
        );
        actualitzarTaula(null,null,null,null,null,null);

    }
    
    private void actualitzarTaula(Integer idUniversitat, Integer idProva, Date dinscripcio_ini,
            Date dinscripcio_fi, Date drealitacio_ini, Date drealitacio_fi) throws RemoteException, EOlympicsException{
        ArrayList<HashMap> resultats = remot.consultarProves(idUniversitat,idProva,
                dinscripcio_ini,dinscripcio_fi,drealitacio_ini,drealitacio_fi);
        String [] columnes = new String [] {
                "",
                TDSLanguageUtils.getMessage("informes.prova"),
                TDSLanguageUtils.getMessage("informes.tipus"),
                TDSLanguageUtils.getMessage("informes.preguntes"),
                TDSLanguageUtils.getMessage("informes.dinscripcio"),
                TDSLanguageUtils.getMessage("informes.dinscripcio"),
                TDSLanguageUtils.getMessage("informes.drealitzacio"),
                TDSLanguageUtils.getMessage("informes.drealitzacio"),
                TDSLanguageUtils.getMessage("informes.places"),
                TDSLanguageUtils.getMessage("informes.participants"),
                TDSLanguageUtils.getMessage("informes.inscripcions"),
                TDSLanguageUtils.getMessage("informes.encerts"),
                TDSLanguageUtils.getMessage("informes.errors"),
                TDSLanguageUtils.getMessage("informes.blanc"),
                TDSLanguageUtils.getMessage("informes.total"),
                TDSLanguageUtils.getMessage("informes.min"),
                TDSLanguageUtils.getMessage("informes.max"),
            };
        Object [][] dades = new Object [resultats.size()][17];
        
        
        dtm= new DefaultTableModel(dades, columnes);
        jTable1.setModel(dtm);
        int i = 0;
        for (HashMap resultat : resultats){
            dtm.setValueAt(resultat.get("IDPROVA"), i, 0);
            dtm.setValueAt(resultat.get("DESCRIPCIO"), i, 1);
            dtm.setValueAt(resultat.get("TIPUS"), i, 2);
            dtm.setValueAt(resultat.get("NUMPREGUNTES"), i, 3);
            dtm.setValueAt(resultat.get("DINSCRIPCIO_INI"), i, 4);
            dtm.setValueAt(resultat.get("DINSCRIPCIO_FI"), i, 5);
            dtm.setValueAt(resultat.get("DREALITZACIO_INI"), i, 6);
            dtm.setValueAt(resultat.get("DREALITZACIO_FI"), i, 7);
            dtm.setValueAt(resultat.get("NUMPLACES"), i, 8);
            dtm.setValueAt(resultat.get("PARTICIPANTS"), i, 9);
            dtm.setValueAt(resultat.get("INSCRITS"), i, 10);
            dtm.setValueAt(resultat.get("ENCERTS"), i, 11);
            dtm.setValueAt(resultat.get("ERRORS"), i, 12);
            dtm.setValueAt(resultat.get("BLANC"), i, 13);
            dtm.setValueAt(resultat.get("TOTAL"), i, 14);
            dtm.setValueAt(resultat.get("MIN"), i, 15);
            dtm.setValueAt(resultat.get("MAX"), i, 16);
            
            i++;
            
        }
        
        jTable1.addMouseListener(new java.awt.event.MouseAdapter(){
            public void mouseClicked(java.awt.event.MouseEvent e){
                int row=jTable1.rowAtPoint(e.getPoint());
                JOptionPane.showMessageDialog(null,"Id Prova"+ " " +jTable1.getValueAt(row,0).toString()+" PENDENT");
            }

        });
        //Amagem la primera columna
        jTable1.getColumnModel().getColumn(0).setMaxWidth(0);
	jTable1.getColumnModel().getColumn(0).setMinWidth(0);
        jTable1.getTableHeader().getColumnModel().getColumn(0).setMaxWidth(0);
        jTable1.getTableHeader().getColumnModel().getColumn(0).setMinWidth(0);
        /*
                item.put("IDPROVA", rs.getInt(9));*/
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jComboBox2 = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jTextField4 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("Resultat proves finalitzades");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(150, 150, 150)
                .addComponent(jLabel1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel1)
                .addContainerGap(30, Short.MAX_VALUE))
        );

        jLabel2.setText("Universitat");

        jLabel3.setText("Prova");

        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });

        jLabel4.setText("jLabel4");

        jLabel5.setText("jLabel5");

        jTextField1.setText("jTextField1");
        jTextField1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jTextField1FocusLost(evt);
            }
        });

        jTextField2.setText("jTextField2");
        jTextField2.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jTextField2FocusLost(evt);
            }
        });

        jLabel6.setText("jLabel6");

        jLabel7.setText("jLabel7");

        jTextField3.setText("jTextField3");
        jTextField3.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jTextField3FocusLost(evt);
            }
        });

        jTextField4.setText("jTextField4");
        jTextField4.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jTextField4FocusLost(evt);
            }
        });

        jButton1.setText("jButton1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3))
                        .addGap(38, 38, 38)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jComboBox2, 0, 102, Short.MAX_VALUE))
                        .addGap(27, 27, 27)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel6)
                                .addGap(18, 18, 18)
                                .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel7)
                                .addGap(18, 18, 18)
                                .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(212, 212, 212)
                        .addComponent(jButton1)))
                .addContainerGap(208, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 499, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jComboBox1ActionPerformed

    private void jTextField1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField1FocusLost
        if(!EOlympicsUtils.isValidDate(jTextField1.getText().trim())){
            jTextField1.setText(TDSLanguageUtils.getMessage("informes.formatdata"));
        }
    }//GEN-LAST:event_jTextField1FocusLost

    private void jTextField2FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField2FocusLost
        if(!EOlympicsUtils.isValidDate(jTextField2.getText())){
            jTextField2.setText(TDSLanguageUtils.getMessage("informes.formatdata"));
        }        
    }//GEN-LAST:event_jTextField2FocusLost

    private void jTextField3FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField3FocusLost
        if(!EOlympicsUtils.isValidDate(jTextField3.getText())){
            jTextField3.setText(TDSLanguageUtils.getMessage("informes.formatdata"));
        }        
    }//GEN-LAST:event_jTextField3FocusLost

    private void jTextField4FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField4FocusLost
        if(!EOlympicsUtils.isValidDate(jTextField4.getText())){
            jTextField4.setText(TDSLanguageUtils.getMessage("informes.formatdata"));
        } 
    }//GEN-LAST:event_jTextField4FocusLost

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        try {
            Integer idUniversitat = null;
            
            if (jComboBox1.getSelectedItem()!=null){
                idUniversitat= ((Universitat)jComboBox1.getSelectedItem()).getId();
            }
            Prova prova = ((Prova)jComboBox2.getSelectedItem());
            Date dinscripcioinit = null;
            if(EOlympicsUtils.isValidDate(jTextField1.getText().trim())){
                dinscripcioinit = EOlympicsUtils.getDateSimpleFormat(jTextField1.getText().trim());
            }
            Date dinscripciofin = null;
            if(EOlympicsUtils.isValidDate(jTextField3.getText().trim())){
                dinscripciofin = EOlympicsUtils.getDateSimpleFormat(jTextField3.getText().trim());
            }
            
            Date drealitzacioinit = null;
            if(EOlympicsUtils.isValidDate(jTextField2.getText().trim())){
                drealitzacioinit = EOlympicsUtils.getDateSimpleFormat(jTextField2.getText().trim());
            }
            Date drealitzaciofin = null;
            if(EOlympicsUtils.isValidDate(jTextField4.getText().trim())){
                drealitzaciofin = EOlympicsUtils.getDateSimpleFormat(jTextField4.getText().trim());
            }
            actualitzarTaula(idUniversitat, prova.getIdProva(),dinscripcioinit,dinscripciofin,drealitzacioinit,drealitzaciofin );
        } catch (RemoteException ex) {
            //TODO
            System.out.println(ex.toString());
        } catch (EOlympicsException ex) {
            //TODO
            System.out.println(ex.toString());
        }

    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        TDSLanguageUtils.setDefaultLanguage("edu/uoc/tdp/i18n/messages");
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(PantallaProvesFinalitzades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(PantallaProvesFinalitzades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(PantallaProvesFinalitzades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(PantallaProvesFinalitzades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new PantallaProvesFinalitzades().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    // End of variables declaration//GEN-END:variables
}



